<template>
  <div class="order-detail-page"
       v-if="order">
    <DetailAction :order="order"></DetailAction>
    <DetailStep :order="order"></DetailStep>
    <Logistics v-if="[3, 4, 5].includes(order.orderState)"
               :order="order"></Logistics>
    <DetailInfo :order="order"></DetailInfo>
  </div>
</template>

<script>
import { ref } from 'vue'
import { useRoute } from 'vue-router'
import { findOrderDetail } from '@/apis/order'
import DetailAction from './components/detail-action.vue'
import Logistics from './components/detail-logistics.vue'
import DetailStep from './components/detail-step.vue'
import DetailInfo from './components/detail-info.vue'
export default {
  name: 'OrderDetail',
  components: {
    DetailAction,
    Logistics,
    DetailStep,
    DetailInfo
  },
  setup () {
    const order = ref(null)
    const route = useRoute()
    findOrderDetail(route.params.id).then((data) => {
      order.value = data.result
    })
    return { order }
  }
}
</script>

<style scoped lang="less">
.order-detail-page {
  background: #fff;
}
</style>
